<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Canvas</title>
    <style></style>
  </head>
  <body>
    <div class="container">
      <canvas id="demo"></canvas>
    </div>
    <script>
      ;(function () {
        const $canvas = document.querySelector('#demo')
        $canvas.width = 600
        $canvas.height = 600
        $canvas.style.border = '1px solid #cccccc'

        const context = $canvas.getContext('2d')

        context.moveTo(100, 100)
        context.lineTo(200, 100)

        // 类比 css3 中的圆角，
        // xy1 端点1，xy3 端点2，弧度
        // context.arcTo(x1, y1, x2, y2, radius);

        context.arcTo(240, 100, 240, 110, 40)
        context.lineTo(240, 300)

        context.stroke()
      })()
    </script>
  </body>
</html>
